package org.example.Thread;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:Lenovo
 * Date:2022-03-22
 * Time:10:30
 */
class MyThread1 extends java.lang.Thread {
    @Override
    public void run() {
        while (true){
            System.out.println("hello thread");
            try {
                java.lang.Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
public class Demo2 {
    public static void main(String[] args) {
        Thread t = new MyThread1();
        t.start();

        while (true){
            System.out.println("hello world");
            try {
                java.lang.Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
